package com.example.com.daervideo.binding;


import android.databinding.BindingAdapter;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.example.com.daervideo.AppApplication;
import com.example.com.daervideo.R;

import me.goldze.mvvmhabit.utils.GlidRadioTranform;
import me.goldze.mvvmhabit.utils.GlideCircleTransform;


/**
 * Created by goldze on 2017/6/18.
 */
public final class ViewAdapter {

    @BindingAdapter({"visibility"})
    public static void setVisibility(View currentView, boolean isShow) {
        if (isShow) {
            currentView.setVisibility(View.VISIBLE);
        } else {
            currentView.setVisibility(View.GONE);
        }
    }

    @BindingAdapter({"roundSrc"})
    public static void setRoundSrc(ImageView currentView, String url) {
            Glide.with(AppApplication.getInstance()).load(url).placeholder(R.mipmap.ic_launcher)
                    .transform(new GlideCircleTransform(AppApplication.getInstance())).into(currentView);
    }

}

